<?
  session_start();

  require('config.inc.php');

  function connect_db()
  {
      $_SESSION['db_connection'] = mysqli_connect($_SESSION['db_host'], $_SESSION['db_user'], $_SESSION['db_pass'], $_SESSION['db_name']);
  }

  function gettemplate($template,$php=0)
  {
    $file=implode("",file("templates/".$template.".html"));
    if($php) return $file;
    else return str_replace("\"","\\\"",$file);
  }

  function getcontactnumbertype($id)
  {
    $result = mysqli_query($_SESSION['db_connection'], "SELECT * FROM contact_type WHERE id='".$id."';");
    $row = mysqli_fetch_assoc($result);
	$type = $row['name'];
    return $type;
  }

  connect_db();
?>
